package com.olt.dao.oltCenter;

import com.olt.domain.oltCenter.OltClass;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/*

 */
public interface IOltClassDao extends JpaRepository<OltClass, String>, JpaSpecificationExecutor<OltClass> {
    void deleteByClassIdIn(List<String> uuids);

    @Query(value = "select c from OltClass c left join ClassStudent s on c.classId=s.classId " +
            "where c.className like %?1% and  s.userId=?2 and s.joinTime>=?3 and s.joinTime<?4")
    Page<OltClass> getClassByJoin(String key, Long userId, Date minYear, Date maxYear, PageRequest page);
}
